package com.goodiebag.pinview.example;

import com.goodiebag.pinview.Pinview;
import com.goodiebag.pinview.ResourceTable;
import ohos.aafwk.ability.AbilitySlice;
import ohos.aafwk.content.Intent;
import ohos.agp.components.TextField;
import ohos.agp.window.service.WindowManager;

public class MainAbilitySlice extends AbilitySlice {
    @Override
    public void onStart(Intent intent) {
        super.onStart(intent);
        try {
            getWindow().setStatusBarColor(getResourceManager().getElement(ResourceTable.Color_status).getColor());
            getWindow().setInputPanelDisplayType(WindowManager.LayoutConfig.INPUT_ADJUST_PAN);
        } catch (Exception exception) {
            exception.getMessage();
        }
        super.setUIContent(ResourceTable.Layout_ability_main);
        initView();
    }

    private void initView() {
        Pinview pinview = (Pinview) findComponentById(ResourceTable.Id_pinView1);
        TextField componentAt = (TextField) pinview.getComponentAt(0);
        pinview.setPinBackgroundRes(componentAt,2);
    }

    @Override
    public void onActive() {
        super.onActive();
    }

    @Override
    public void onForeground(Intent intent) {
        super.onForeground(intent);
    }
}
